import { List } from 'antd'
import React, { useState } from 'react';
import '../public/styles/component/type.css'

const Type = (props) => {
  const [typeList, setTypeList] = useState(props.data)
  return (
    <div className="type-div common-box">
      <div className="type-title">博文类型</div>
      <List
        size="small"
        dataSource={typeList}
        renderItem={item => (
          <List.Item onClick={() => { props.changeType(item.id) }} style={{ display: "flex", justifyContent: "spaceBetween" }}>
            <span>{item.typeName}</span>
            <span>{item.total} 篇</span>
          </List.Item>
        )}
      />
    </div>
  )
}
export default Type

